import 'package:merchants/models/wechat_user_info.dart';

class WeChatAuthResult {
  final bool success;
  final WeChatUserInfo? userInfo;
  final String? errorMessage;

  WeChatAuthResult({required this.success, this.userInfo, this.errorMessage});

  factory WeChatAuthResult.fromJson(Map<String, dynamic> json) {
    return WeChatAuthResult(
      success: json['success'] as bool,
      userInfo: json['data'] != null
          ? WeChatUserInfo.fromJson(json['data'] as Map<String, dynamic>)
          : null,
      errorMessage: json['message'] as String?,
    );
  }
}
